package exam.web.action.base;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;

import com.opensymphony.xwork2.ActionSupport;

import exam.model.entity.TSubQuestionEntity;
import exam.system.business.BusinessServiceInfo;

/**
 * <p>SubQuestionActionBase</p>
 * 
 * @author Phong
 * @version 09/05/2012
 */

public class SubQuestionActionBase extends ActionSupport 
		implements ServletRequestAware, ServletResponseAware {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	// Dinh nghia ket qua tra ve FAIl
	protected static final String FAIL ="fail";
	
	// serviceInfor
	protected BusinessServiceInfo serviceInfo = new BusinessServiceInfo();
	
	// request
	protected HttpServletRequest request;
	
	// response
	protected HttpServletResponse response;
	
	/*
	 * Dinh nghia cac thuoc tinh cua bang T_SUB_QUESTION
	 */
	// SUB_QUEST_ID
	protected long subQuestId;
	// SUBJECT
	protected String subject;
	// USER_ID
	protected long userId;
	// CREATE_DATE
	protected Date createDate;
	// UPDATE_DATE
	protected Date updateDate;
	
	// Set/Get subQuestId
	public long getSubQuestId() {
		return subQuestId;
	}
	public void setSubQuestId(long subQuestId) {
		this.subQuestId = subQuestId;
	}

	// Set/Get subject
	public String getSubject() {
		return subject;
	}
	public void setSubject(String subject) {
		this.subject = subject;
	}

	// Set/Get userId
	public long getUserId() {
		return userId;
	}
	public void setUserId(long userId) {
		this.userId = userId;
	}

	// Set/Get createDate
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	// Set/Get updateDate
	public Date getUpdateDate() {
		return updateDate;
	}
	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}
	
	/**
	 * copyToTSubQuestionEntity
	 * @param tSubQuestionEntity
	 */
	public void copyToTSubQuestionEntity(TSubQuestionEntity tSubQuestionEntity) {
		tSubQuestionEntity.setSubQuestId(subQuestId);
		tSubQuestionEntity.setSubject(subject);
		tSubQuestionEntity.setUserId(userId);
	}
	
	/**
	 * copyFromTSubQuestionEntity
	 * @param tSubQuestionEntity
	 */
	public void copyFromTSubQuestionEntity(TSubQuestionEntity tSubQuestionEntity) {
		subQuestId = tSubQuestionEntity.getSubQuestId();
		userId = tSubQuestionEntity.getUserId();
		subject = tSubQuestionEntity.getSubject();
		createDate = tSubQuestionEntity.getCreateDate();
		updateDate = tSubQuestionEntity.getUpdateDate();
	}
	
	@Override
	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}

	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}
}
